package com.company.task4;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class SearchStudentInfo {

    public static void searchFunction(List<ArrayList> studentList){

        if(0 == studentList.size()){
            System.out.println("系统中无学生信息，请选择增加选项增添学生信息！");
            return;
        }

        System.out.println("请输入学生学号：");
        Scanner sc = new Scanner(System.in);
        String stuNo = sc.next();

        int length = studentList.size();
        for(int i = 0; i < length; i++){
            if(studentList.get(i).contains(stuNo)){
                System.out.println("该学生信息如下：" + studentList.get(i));
                return;
            }
        }
        System.out.println("未查到该生信息！");
    }
}
